import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '../views/Layout.vue'

Vue.use(VueRouter)

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

const routes = [{
    path: '/',
    redirect: '/home/userlist',
    name: 'Layout',
    component: Layout,
    children: [{
        path: 'home',
        name: 'Home',
        component: () =>
            import('../views/userManage/Home.vue'),
        children: [{
            path: 'userlist',
            name: 'UserList',
            component: () =>
                import('../views/userManage/UserList.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'useraddday',
            name: 'UserAddDay',
            component: () =>
                import('../views/userManage/UserAddDay.vue'),
            meta: {
                auth: true,
            }
        }, {
            path: 'useraddmonth',
            name: 'UserAddMonth',
            component: () =>
                import('../views/userManage/UserAddMonth.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'useraddweek',
            name: 'UserAddWeek',
            component: () =>
                import('../views/userManage/UserAddWeek.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'adduser',
            name: 'AddUser',
            component: () =>
                import('../views/userManage/AddUser.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'collisioninquiry',
            name: 'CollisionInquiry',
            component: () =>
                import('../views/userManage/CollisionInquiry.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'customsettings',
            name: 'CustomSettings',
            component: () =>
                import('../views/userManage/CustomSettings.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'protectionperiodsetting',
            name: 'ProtectionPeriodSetting',
            component: () =>
                import('../views/userManage/ProtectionPeriodSetting.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'dictionarycontroller',
            name: 'DictionaryController',
            component: () =>
                import('../views/userManage/DictionaryController.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'fixzidingyi',
            name: 'FixZiDingYi',
            component: () =>
                import('../views/userManage/FixZiDingYi.vue'),
            meta: {
                auth: true
            }
        }],
        meta: {
            auth: true
        }
    },
    {
        path: 'gendan',
        name: 'Gendan',
        component: () =>
            import('../views/Gendan/Gendan.vue'),
        children: [{
            path: 'gendanlist',
            name: 'GendanList',
            component: () =>
                import('../views/Gendan/GendanList.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'gendantoday',
            name: 'GendanToday',
            component: () =>
                import('../views/Gendan/GendanToday.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'gendanweek',
            name: 'GendanWeek',
            component: () =>
                import('../views/Gendan/GendanWeek.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'gendantodaylog',
            name: 'GendanTodayLog',
            component: () =>
                import('../views/Gendan/GendanTodayLog.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'gendanweeklog',
            name: 'GendanWeekLog',
            component: () =>
                import('../views/Gendan/GendanWeekLog.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'gendanmonthlog',
            name: 'GendanMonthLog',
            component: () =>
                import('../views/Gendan/GendanMonthLog.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'gendanadd',
            name: 'GendanAdd',
            component: () =>
                import('../views/Gendan/GendanAdd.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'gendanedit',
            name: 'GendanEdit',
            component: () =>
                import('../views/Gendan/GendanEdit.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'gendanfile',
            name: 'GendanFile',
            component: () =>
                import('../views/Gendan/GendanFile.vue'),
            meta: {
                auth: true
            }

        }],
        meta: {
            auth: true
        }
    },
    {
        path: 'agreement',
        name: 'Agreement',
        component: () =>
            import('../views/Agreement.vue'),
        children: [{
            path: 'agreementNext',
            name: 'AgreementNext',
            component: () =>
                import('../views/AgreenChildren/AgreementList.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'todayIncrease',
            name: 'TodayIncrease',
            component: () =>
                import('../views/AgreenChildren/TodayIncrease.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'weekIncrease',
            name: 'WeekIncrease',
            component: () =>
                import('../views/AgreenChildren/WeekIncrease.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'monthIncrease',
            name: 'MonthIncrease',
            component: () =>
                import('../views/AgreenChildren/MonthIncrease.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'todayDeal',
            name: 'TodayDeal',
            component: () =>
                import('../views/AgreenChildren/TodayDeal.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'monthDeal',
            name: 'MonthDeal',
            component: () =>
                import('../views/AgreenChildren/MonthDeal.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'weekDeal',
            name: 'WeekDeal',
            component: () =>
                import('../views/AgreenChildren/WeekDeal.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'derivedData',
            name: 'DerivedData',
            component: () =>
                import('../views/AgreenChildren/DerivedData.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'increaseContranct',
            name: 'IncreaseContranct',
            component: () =>
                import('../views/AgreenChildren/IncreaseContranct.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'contractNumber',
            name: 'ContractNumber',
            component: () =>
                import('../views/AgreenChildren/ThirdChildren/ContractNumber.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'contranctStatus',
            name: 'ContranctStatus',
            component: () =>
                import('../views/AgreenChildren/ThirdChildren/ContranctStatus.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'appendix',
            name: 'Appendix',
            component: () =>
                import('../views/AgreenChildren/ThirdChildren/Appendix.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'edit',
            name: 'Edit',
            component: () =>
                import('../views/AgreenChildren/ThirdChildren/Edit.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'renew',
            name: 'Renew',
            component: () =>
                import('../views/AgreenChildren/ThirdChildren/Renew.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'addkinds',
            name: 'Addkinds',
            component: () =>
                import('../views/AgreenChildren/Addkinds.vue'),
            meta: {
                auth: true
            }
        },],
        meta: {
            auth: true
        }
    },
    {
        path: 'order',
        name: 'Order',
        component: () =>
            import('../views/Order.vue'),
        children: [
            // 订单上面导航的路由
            {
                path: 'orderlist',
                name: 'OrderList',
                component: () =>
                    import('../views/Order/OrderList.vue'),
                meta: {
                    auth: true
                }
            },
            {
                path: 'orderadd-day',
                name: 'OrderAddDay',
                component: () =>
                    import('../views/Order/OrderList.vue'),
                meta: {
                    auth: true
                }
            },
            {
                path: 'orderadd-week',
                name: 'OrderAddWeek',
                component: () =>
                    import('../views/Order/OrderList.vue'),
                meta: {
                    auth: true
                }
            },
            {
                path: 'orderadd-month',
                name: 'OrderAddMonth',
                component: () =>
                    import('../views/Order/OrderList.vue'),
                meta: {
                    auth: true
                }
            },
            {
                path: 'data-export',
                name: 'DataExport',
                component: () =>
                    import('../views/Order/DataExport.vue'),
                meta: {
                    auth: true
                }
            },
            {
                path: 'addorder',
                name: 'AddOrder',
                component: () =>
                    import('../views/Order/AddOrder.vue'),
                meta: {
                    auth: true
                }
            },
            {
                path: 'editorder',
                name: 'EditOrder',
                component: () =>
                    import('../views/Order/EditOrder.vue'),
                meta: {
                    auth: true
                }
            },
            {
                path: 'addorderpage',
                name: 'AddOrderPage',
                component: () =>
                    import('../views/Order/AddOrderPage.vue'),
                meta: {
                    auth: true
                }
            },
            {
                path: 'ordernumber',
                name: 'OrderNumber',
                component: () =>
                    import('../views/Order/TableDetail/OrderNumber.vue'),
                meta: {
                    auth: true
                }
            },
            {
                path: 'orderstate',
                name: 'OrderState',
                component: () =>
                    import('../views/Order/TableDetail/OrderState.vue'),
                meta: {
                    auth: true
                }
            },
            {
                path: 'consignstate',
                name: 'ConsignState',
                component: () =>
                    import('../views/Order/TableDetail/ConsignState.vue'),
                meta: {
                    auth: true
                }
            },
            {
                path: 'accessory',
                name: 'Accessory',
                component: () =>
                    import('../views/Order/TableDetail/Accessory.vue'),
                meta: {
                    auth: true
                }
            },
            {
                path: 'ordergoods',
                name: 'OrderGoods',
                component: () =>
                    import('../views/Order/TableDetail/OrderGoods.vue'),
                meta: {
                    auth: true
                }
            },
            {
                path: 'ordersetting',
                name: 'OrderSetting',
                component: () =>
                    import('../views/Order/TableDetail/OrderSetting.vue'),
                meta: {
                    auth: true
                }
            },
            // 新增商品
            {
                path: 'orderadd',
                name: 'OrderAdd',
                component: () =>
                    import('../views/Order/TableDetail/OrderAdd.vue'),
                meta: {
                    auth: true
                }
            },
            // 新增联系人
            {
                path: 'cantactadd',
                name: 'cantactAdd',
                component: () =>
                    import('../views/Order/TableDetail/cantactAdd.vue'),
                meta: {
                    auth: true
                }
            },
        ],
        meta: {
            auth: true
        }
    },
    // 售后管理路由
    {
        path: 'afterSale',
        name: 'AfterSale',
        redirect: '/afterSale/afterSaleList',
        component: () =>
            import('../views/AfterSale/AfterSale.vue'),
        children: [{
            path: 'afterSaleList',
            name: 'AfterSaleList',
            component: () =>
                import('../views/AfterSale/AfterSaleList.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'afterSaleProcessed',
            name: 'AfterSaleProcessed',
            component: () =>
                import('../views/AfterSale/AfterSaleList.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'afterSaleProcessing',
            name: 'AfterSaleProcessing',
            component: () =>
                import('../views/AfterSale/AfterSaleList.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'afterSaleUntreated',
            name: 'AfterSaleUntreated',
            component: () =>
                import('../views/AfterSale/AfterSaleList.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'afterSaleAdd',
            name: 'AfterSaleAdd',
            component: () =>
                import('../views/AfterSale/AfterSaleAdd.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'afterSaleAttachment',
            name: 'AfterSaleAttachment',
            component: () =>
                import('../views/AfterSale/AfterSaleAttachment.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'addAfterSale',
            name: 'AddAfterSale',
            component: () =>
                import('../views/AfterSale/AddAfterSale.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'newAfterSale',
            name: 'NewAfterSale',
            component: () =>
                import('../views/AfterSale/NewAfterSale.vue'),
            meta: {
                auth: true
            }
        },
        // 新增联系人
        {
            path: 'cantactadd',
            name: 'cantactAdd',
            component: () =>
                import('../views/AfterSale/cantactAdd.vue'),
            meta: {
                auth: true
            }
        },
        ],
        meta: {
            auth: true
        }

    },
    {
        path: 'information',
        name: 'Information',
        component: () =>
            import('../views/Information/Information.vue'),
        children: [{
            path: "baseinfo",
            name: "BaseInfo",
        },
        // 点击列表里面的值跳转的路由
        {
            path: 'clientname',
            name: 'ClientName',
            component: () =>
                import('../views/Order/OrderList.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'afterSaleInformation',
            name: 'AfterSaleInformation',
            component: () =>
                import('../views/AfterSale/AfterSaleList.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'gendanlist',
            name: 'GendanList',
            component: () =>
                import('../views/Gendan/GendanList.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'contranct',
            name: 'Contranct',
            component: () =>
                import('../views/AgreenChildren/ThirdChildren/Contranct'),
            meta: {
                auth: true
            }
        },
        ],
        meta: {
            auth: true
        }
    },

    {
        path: 'money',
        name: 'Money',
        component: () =>
            import('../views/Money.vue'),
        children: [{
            path: 'incomelist',
            name: 'IncomeList',
            component: () =>
                import('../views/Money/IncomeList.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'todayincome',
            name: 'TodayIncome',
            component: () =>
                import('../views/Money/TodayIncome.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'weekincome',
            name: 'WeekIncome',
            component: () =>
                import('../views/Money/WeekIncome.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'monthincome',
            name: 'MonthIncome',
            component: () =>
                import('../views/Money/MonthIncome.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'exportincomedata',
            name: 'ExportIncomeData',
            component: () =>
                import('../views/Money/ExportIncomeData.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'addincomedata',
            name: 'AddIncomeData',
            component: () =>
                import('../views/Money/AddIncomeData.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'addexpenddata',
            name: 'AddExpendData',
            component: () =>
                import('../views/Money/AddExpendData.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: "addinoutcome",
            name: "AddInOutCome",
            component: () =>
                import('../views/Money/MoneyDetail/AddInOutCome.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'myset',
            name: 'MySet',
            component: () =>
                import('../views/Money/MySet.vue'),
            meta: {
                auth: true
            }
        }, {
            path: "modifyinoutcome",
            name: "ModifyInOutCome",
            component: () =>
                import('../views/Money/MoneyDetail/ModifyInOutCome.vue'),
            meta: {
                auth: true
            }
        }
        ],
        meta: {
            auth: true
        }
    },
    {
        path: 'customerseas',
        name: 'CustomerSeas',
        component: () =>
            import('../views/CustomerSeas.vue'),
        children: [{
            path: 'addpool',
            name: 'AddPool',
            component: () =>
                import('../views/CustomerSeas/AddPool.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'checking',
            name: 'Checking',
            component: () =>
                import('../views/CustomerSeas/Checking.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'exporting',
            name: 'Exporting',
            component: () =>
                import('../views/CustomerSeas/Exporting.vue'),
            meta: {
                auth: true
            }
        },
        // 点击列表里面的值跳转的路由
        {
            path: 'importing',
            name: 'Importing',
            component: () =>
                import('../views/CustomerSeas/Importing.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'poollist',
            name: 'PoolList',
            component: () =>
                import('../views/CustomerSeas/PoolList.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'repeatingdata',
            name: 'RepeatingData',
            component: () =>
                import('../views/CustomerSeas/RepeatingData.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'setting',
            name: 'Setting',
            component: () =>
                import('../views/CustomerSeas/Setting.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'editlist',
            name: 'EditList',
            component: () =>
                import('../views/CustomerSeas/Edit/EditList.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'seasdetails',
            name: 'SeasDetails',
            component: () =>
                import('../views/CustomerSeas/Edit/SeasDetails.vue'),
            meta: {
                auth: true
            }
        },
        ],
        meta: {
            auth: true
        }
    },
    {
        path: 'goods',
        name: 'Goods',
        component: () =>
            import('../views/Goods/Goods.vue'),
        children: [{
            path: 'commodity',
            name: 'Commodity',
            component: () =>
                import('../views/Goods/index.vue'),
            children: [{
                path: 'commodityMsg',
                name: 'CommodityMsg',
                component: () =>
                    import('../views/Goods/Commodity/Commodity.vue'),
                meta: {
                    auth: true
                }
            }, {
                path: 'commodityClassification',
                name: 'CommodityClassification',
                component: () =>
                    import('../views/Goods/Commodity/CommodityClassification.vue'),
                meta: {
                    auth: true
                }
            }, {
                path: 'commodityImport',
                name: 'CommodityImport',
                component: () =>
                    import('../views/Goods/Commodity/CommodityImport.vue'),
                meta: {
                    auth: true
                }
            }, {
                path: 'commodityAdd',
                name: 'CommodityAdd',
                component: () =>
                    import('../views/Goods/Commodity/CommodityAddEdit.vue'),
                meta: {
                    auth: true
                }
            }, {
                path: 'commodityEdit',
                name: 'CommodityEdit',
                component: () =>
                    import('../views/Goods/Commodity/CommodityAddEdit.vue'),
                meta: {
                    auth: true
                }
            }],
            meta: {
                auth: true
            }
        }, {
            path: 'purchase',
            name: 'Purchase',
            component: () =>
                import('../views/Goods/index.vue'),
            children: [{
                path: 'purchaseMsg',
                name: 'PurchaseMsg',
                component: () =>
                    import('../views/Goods/Purchase/Purchase.vue'),
                meta: {
                    auth: true
                }
            }, {
                path: 'purchaseAdd',
                name: 'PurchaseAdd',
                component: () =>
                    import('../views/Goods/Purchase/PurchaseAddEdit.vue'),
                meta: {
                    auth: true
                }
            }, {
                path: 'purchaseEdit',
                name: 'PurchaseEdit',
                component: () =>
                    import('../views/Goods/Purchase/PurchaseAddEdit.vue'),
                meta: {
                    auth: true
                }
            }],
            meta: {
                auth: true
            }
        }, {
            path: 'supplier',
            name: 'Supplier',
            component: () =>
                import('../views/Goods/index.vue'),
            children: [{
                path: 'supplierMsg',
                name: 'SupplierMsg',
                component: () =>
                    import('../views/Goods/Supplier/Supplier.vue'),
                meta: {
                    auth: true
                }
            }, {
                path: 'supplierAdd',
                name: 'SupplierAdd',
                component: () =>
                    import('../views/Goods/Supplier/SupplierAddEdit.vue'),
                meta: {
                    auth: true
                }
            }, {
                path: 'supplierEdit',
                name: 'SupplierEdit',
                component: () =>
                    import('../views/Goods/Supplier/SupplierAddEdit.vue'),
                meta: {
                    auth: true
                }
            }],
            meta: {
                auth: true
            }
        }, {
            path: 'warehouse',
            name: 'Warehouse',
            component: () =>
                import('../views/Goods/index.vue'),
            children: [{
                path: 'warehouseMsg',
                name: 'WarehouseMsg',
                component: () =>
                    import('../views/Goods/Warehouse/Warehouse.vue'),
                meta: {
                    auth: true
                }
            }, {
                path: 'warehouseAdd',
                name: 'WarehouseAdd',
                component: () =>
                    import('../views/Goods/Warehouse/WarehouseAddEdit.vue'),
                meta: {
                    auth: true
                }
            }, {
                path: 'warehouseEdit',
                name: 'WarehouseEdit',
                component: () =>
                    import('../views/Goods/Warehouse/WarehouseAddEdit.vue'),
                meta: {
                    auth: true
                }
            }],
            meta: {
                auth: true
            }
        }, {
            path: 'salesRecord',
            name: 'SalesRecord',
            component: () =>
                import('../views/Goods/SalesRecord.vue'),
            meta: {
                auth: true
            }
        }],
        meta: {
            auth: true
        }

    }, {
        path: 'staff',
        name: 'Staff',
        component: () =>
            import('../views/Staff.vue'),
        children: [{
            path: 'department-set',
            name: 'DepartmentSet',
            component: () =>
                import('../views/Staff/DepartmentSet.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'role-based',
            name: 'RoleBased',
            component: () =>
                import('../views/Staff/RoleBased.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'staff-list',
            name: 'StaffList',
            component: () =>
                import('../views/Staff/StaffList.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'add-staff',
            name: 'AddStaff',
            component: () =>
                import('../views/Staff/AddStaff.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'management-range',
            name: 'ManagementRange',
            component: () =>
                import('../views/Staff/StaffChildren/ManagementRange'),
            meta: {
                auth: true
            }

        }, {
            path: 'permissions',
            name: 'Permissions',
            component: () =>
                import('../views/Staff/StaffChildren/Permissions.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'alter',
            name: 'Alter',
            component: () =>
                import('../views/Staff/StaffChildren/Alter.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'add-permissions',
            name: 'AddPermissions',
            component: () =>
                import('../views/Staff/StaffChildren/AddPermissions.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'alter-permissions',
            name: 'AlterPermissions',
            component: () =>
                import('../views/Staff/StaffChildren/AlterPermissions.vue'),
            meta: {
                auth: true
            }
        }],
        meta: {
            auth: true
        }
    }, {
        path: 'addressbook',
        name: 'AddressBook',
        component: () =>
            import('../views/AddressBook.vue'),
        children: [{
            path: 'businessone',
            name: 'BusinessOne',
            component: () =>
                import('../views/AdressBookChildren/BusinessOne.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'businesstwo',
            name: 'BusinessTwo',
            component: () =>
                import('../views/AdressBookChildren/BusinessTwo.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'channeldep',
            name: 'ChannelDep',
            component: () =>
                import('../views/AdressBookChildren/ChannelDep.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'channeldep',
            name: 'ChannelDep',
            component: () =>
                import('../views/AdressBookChildren/ChannelDep.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'customerserver',
            name: 'CustomerServer',
            component: () =>
                import('../views/AdressBookChildren/CustomerServer.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'financedept',
            name: 'FinanceDept',
            component: () =>
                import('../views/AdressBookChildren/FinanceDept.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'generalmanager',
            name: 'GeneralManager',
            component: () =>
                import('../views/AdressBookChildren/GeneralManager.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'leavelist',
            name: 'LeaveList',
            component: () =>
                import('../views/AdressBookChildren/LeaveList.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'maketingdep',
            name: 'MaketingDep',
            component: () =>
                import('../views/AdressBookChildren/LeaveList.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'phonelist',
            name: 'PhoneList',
            component: () =>
                import('../views/AdressBookChildren/PhoneList.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'purchasingdep',
            name: 'PurchasingDep',
            component: () =>
                import('../views/AdressBookChildren/PurchasingDep.vue'),
            meta: {
                auth: true
            }
        }],
        meta: {
            auth: true
        }
    }, {
        path: 'data',
        name: 'Data',
        component: () =>
            import('../views/Data.vue'),
        children: [{
            path: 'afterSales',
            name: 'AfterSales',
            component: () =>
                import('../views/Datalist/After-sales.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'annualCurve',
            name: 'AnnualCurve',
            component: () =>
                import('../views/Datalist/AnnualCurve.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'contractStatistics',
            name: 'ContractStatistics',
            component: () =>
                import('../views/Datalist/ContractStatistics.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'customerAnalysis',
            name: 'CustomerAnalysis',
            component: () =>
                import('../views/Datalist/CustomerAnalysis.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'customerProfile',
            name: 'CustomerProfile',
            component: () =>
                import('../views/Datalist/CustomerProfile.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'detailedData',
            name: 'DetailedData',
            component: () =>
                import('../views/Datalist/DetailedData.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'followUp',
            name: 'FollowUp',
            component: () =>
                import('../views/Datalist/Follow-up.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'orderCommission',
            name: 'OrderCommission',
            component: () =>
                import('../views/Datalist/OrderCommission.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'orderStatistics',
            name: 'OrderStatistics',
            component: () =>
                import('../views/Datalist/OrderStatistics.vue'),
            meta: {
                auth: true
            }
        }, {
            path: 'ticketStatistics',
            name: 'TicketStatistics',
            component: () =>
                import('../views/Datalist/TicketStatistics.vue'),
            meta: {
                auth: true
            }
        },],
        meta: {
            auth: true
        }
        // children: [{
        //     path: 'afterSales',
        //     name: 'AfterSales',
        //     component: () =>
        //         import('../views/Datalist/AfterSales.vue')
        // }]
    }, {
        path: 'callback',
        name: 'Callback',
        component: () =>
            import('../views/Callback.vue'),
        children: [{
            path: 'deleted',
            name: 'Deleted',
            component: () =>
                import('../views/Callback/Deleted.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'deletedday',
            name: 'DeletedDay',
            component: () =>
                import('../views/Callback/DeletedDay.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'deletedweek',
            name: 'DeletedWeek',
            component: () =>
                import('../views/Callback/DeletedWeek.vue'),
            meta: {
                auth: true
            }
        },
        {
            path: 'deletedmouth',
            name: 'DeletedMouth',
            component: () =>
                import('../views/Callback/DeletedMouth.vue'),
            meta: {
                auth: true
            }
        }
        ],
        meta: {
            auth: true
        }
    },
    ]
},
{
    path: '/login',
    name: 'Login',
    component: () =>
        import('../views/Login.vue')
},
]

const router = new VueRouter({
    routes
})

//路由拦截
router.beforeEach((to, from, next) => {
    const token = sessionStorage.getItem("token")
    if (to.meta.auth) {
        if (token) {
            next()
        } else {
            next({
                path: '/login',
                query: {
                    redirect: to.fullPath
                }
            })
        }
    } else {
        next()
    }
})


export default router